﻿<%@ Page Title="Snap to Control" Language="C#" MasterPageFile="~/Demo.master" StylesheetTheme="start"
    Inherits="DemoPage" %>

<%@ Register Src="~/CodeFormatter.ascx" TagName="Code" TagPrefix="demo" %>
<asp:Content ID="Content1" ContentPlaceHolderID="DemoHolder" runat="Server">
    <div class="dna-state-help ui-corner-all" style="margin-bottom: 10px;">
        Snap the draggable Control to the inner or outer boundaries of a Control/Html Element.
        Use the <b>AllowSnap</b>, <b>SnapMode</b> (Inner, Outer, Both), and <b>SnapOffset</b>
        (distance in pixels the draggable Control must be from the control when snapping
        is invoked) properties. Or snap the draggable Control to a grid. Set the dimensions
        of grid cells (height and width in pixels) with the <b>SnapX</b>,<b>SnapY</b> properties.
    </div>
    <style type="text/css">
        .draggable { width: 90px; height: 80px; padding: 5px; float: left; margin: 0 10px 10px 0; font-size: .9em; }
        .ui-widget-header p, .ui-widget-content p { margin: 0; }
    </style>
    <asp:Panel ID="Panel3" runat="server" CssClass="ui-widget-header" Height="140px">
        <p>
            I'm a snap target</p>
    </asp:Panel>
    <br clear="both" />
    <asp:Panel ID="Panel1" runat="server" CssClass="draggable ui-widget-content">
        <p>
            Default (snap: true), snaps to all other draggable elements</p>
    </asp:Panel>
    <asp:Panel ID="Panel2" runat="server" CssClass="draggable ui-widget-content">
        <p>
            I only snap to the big box</p>
    </asp:Panel>
    <asp:Panel ID="Panel4" runat="server" CssClass="draggable ui-widget-content">
        <p>
            I only snap to the outer edges of the big box</p>
    </asp:Panel>
    <asp:Panel ID="Panel5" runat="server" CssClass="draggable ui-widget-content">
        <p>
            I snap to a 20 x 20 grid</p>
    </asp:Panel>
    <asp:Panel ID="Panel6" runat="server" CssClass="draggable ui-widget-content">
        <p>
            I snap to a 80 x 80 grid</p>
    </asp:Panel>
    <DotNetAge:Draggable ID="Draggable1" runat="server" AllowSnap="true">
        <Target TargetID="Panel1" />
    </DotNetAge:Draggable>
    <DotNetAge:Draggable ID="Draggable2" runat="server">
        <Target TargetID="Panel2" />
        <SnapTo TargetID="Panel3" />
    </DotNetAge:Draggable>
    <DotNetAge:Draggable ID="Draggable3" runat="server" AllowSnap="True" SnapMode="Outer">
        <Target TargetID="Panel4" />
        <SnapTo TargetID="Panel3" />
    </DotNetAge:Draggable>
    <DotNetAge:Draggable ID="Draggable4" runat="server" SnapX="20" SnapY="20">
        <Target TargetID="Panel5" />
    </DotNetAge:Draggable>
    <DotNetAge:Draggable ID="Draggable5" runat="server" SnapX="80" SnapY="80">
        <Target TargetID="Panel6" />
    </DotNetAge:Draggable>
    <br />
    <div style="clear: left;">
    </div>
    <demo:Code runat="server" ID="codeView" SourceFile="~/Draggable/Codes/Snap.aspx" />
</asp:Content>
